import { createApp } from "vue";
import { createPinia } from "pinia";
import ElementPlus from "element-plus";
import "element-plus/dist/index.css";
import * as ElementPlusIcons from "@element-plus/icons-vue";
import zhCn from "element-plus/es/locale/lang/zh-cn";
import * as echarts from "echarts";
import VChart from "vue-echarts";
import App from "./App.vue";
import router from "./router";
import mTable from "@/components/mTableLayout/table/index.vue";
import mForm from "@/components/mTableLayout/form/index.vue";
import mTableLayout from "@/components/mTableLayout/index.vue";

const app = createApp(App);
const pinia = createPinia();

// 注册所有图标
for (const [key, component] of Object.entries(ElementPlusIcons)) {
  app.component(key, component);
}
app.use(echarts);
app.component("v-chart", VChart);
app.component("mTable", mTable);
app.component("mForm", mForm);
app.component("mTableLayout", mTableLayout);
app.use(pinia);
app.use(ElementPlus, {
  config: {
    dropdown: {
      teleported: true,
      trigger: "click",
    },
  },
  locale: zhCn,
});
app.use(router);
app.mount("#app");
